<?php
/**
 * @Name: ApiException.php
 * @Author: yashuai
 * @Desc
 * @Time 2021/8/15 23:17
 */

namespace App\Exceptions;

class ApiException extends \Exception
{

    public $data = [];

    public function __construct($message = "", $code = 500, $data = [])
    {
        $this->data = $data;
        parent::__construct($message, $code);
    }

    /**
     * @return \Illuminate\Http\JsonResponse
     */
    public function render()
    {
        return _fail($this->code, $this->message, $this->data);
    }

}
